package com.tiancikeji.zaoke.app.model.order;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class PayRedirect implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = -5009346302620767989L;

    private final String webUrl;

    private final String wapUrl;

    private final int type;

    public static final int TYPE_ERROR = 1;

    public static final int TYPE_GATEWAY = 2;

    public static final int TYPE_SUCCESS = 3;
    
    /**
     * 判定为是黄牛的返回类型
     */
    public static final int TYPE_FRAUD = 4;

    public PayRedirect(String webUrl, String wapUrl, int type) {
        this.webUrl = webUrl;
        this.wapUrl = wapUrl;
        this.type = type;
        
    }

    public String getWebUrl() {
        return webUrl;
    }

    public String getWapUrl() {
        return wapUrl;
    }

    public boolean isError() {
        return type == TYPE_ERROR;
    }

    public boolean isGateway() {
        return type == TYPE_GATEWAY;
    }

    public boolean isSuccess() {
        return type == TYPE_SUCCESS;
    }
    
    public boolean isFraud() {
        return type == TYPE_FRAUD;
    }

	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}

	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

}
